if get_option('enable_tests') and cli_enabled
  test_conf_data = configuration_data()
  test_conf_data.set_quoted('RIZIN_BUILD_PATH', rizin_exe.full_path())
  test_conf_data.set_quoted('TEST_BUILD_TYPES_DIR', fs.as_posix(types_build_dir))
  test_config_h = configure_file(
    input: 'test_config.h.in',
    output: 'test_config.h',
    configuration: test_conf_data,
  )

  tests = [
    'analysis_fcn',
    'analysis_global_var',
    'analysis_graph',
    'analysis_il',
    'autocmplt',
    'auto_analysis',
    'basefind',
    'bin',
    'bin_symbols',
    'bin_vfiles',
    'cpu_platform_profiles',
    'dwarf',
    'dwarf_info',
    'dwarf_integration',
    'glibc_version',
    'open_analyse_save_load_project',
    'pdb',
    'project_migrate',
    'rzpipe',
    'str_search',
  ]

  unit_test_env = environment()
  if test_env_common_path != []
    unit_test_env.prepend('PATH', test_env_common_path)
  endif

  foreach test : tests
    exe = executable('test_@0@'.format(test), 'test_@0@.c'.format(test),
      # '.' to find autogenerated "test_config.h"
      include_directories: [platform_inc, '.'],
      dependencies: [
        rz_util_dep,
        rz_main_dep,
        rz_socket_dep,
        rz_core_dep,
        rz_io_dep,
        rz_search_dep,
        rz_bin_dep,
        rz_flag_dep,
        rz_cons_dep,
        rz_arch_dep,
        rz_debug_dep,
        rz_config_dep,
        rz_reg_dep,
        rz_syscall_dep,
        rz_type_dep,
        rz_egg_dep,
        rz_search_dep,
        rz_hash_dep,
        rz_crypto_dep,
        rz_magic_dep,
        lrt,
      ],
      install: false,
      install_rpath: rpath_exe,
      implicit_include_directories: false,
    )
    test(test, exe, workdir: join_paths(meson.current_source_dir(), '..'), env: unit_test_env, suite: 'integration')
  endforeach
endif
